<#include "/common/taglibs.ftl" />
<meta name="decorator" content="simple"/>
<title><@spring.message code="${entityName!}" /> - <@spring.message code="${op}" /></title>
<div class="m-portlet">
    <div class="m-portlet__head">
        <div class="m-portlet__head-caption">
            <div class="m-portlet__head-title">
                <span class="m-portlet__head-icon">
                    <i class="flaticon-calendar"></i>
                </span>
                <h3 class="m-portlet__head-text m--font-primary">
                <@spring.message code="${entityName!}" /> / <@spring.message code="${op}" />
                <#if op != 'op.view'>
                    （<@spring.message code="reuqired.tips"/>）
                </#if>
                </h3>
            </div>
        </div>
        <div class="m-portlet__head-tools">
        <#include "/common/component/tree/treeNav.ftl" />
        </div>
    </div>
    <!--begin::Form-->
    <form class="m-form m-form--fit m-form--label-align-right" method="post" id="mainForm">
        <div class="m-portlet__body">
            <div class="m-form__content">
            <@showFieldErrors commandName="m" />
                <#include "/common/taglibs/validationMessage.ftl">
            </div>
            <input type="hidden" id="moveType" name="moveType" value="">
            <div class="form-group m-form__group row">
                <label class="col-form-label col-lg-3 col-sm-12"><@spring.message code="tree.source"/></label>
                <div class="col-lg-4 col-md-9 col-sm-12">
                    <p class="form-control-static"> <i class="${(source.icon)!}"></i> ${(source.name)!}  </p>
                </div>
            </div>
            <div class="form-group m-form__group row">
                <label class="col-form-label col-lg-3 col-sm-12"><@spring.message code="tree.target"/><span class="required"> * </span></label>
                <div class="col-lg-4 col-md-9 col-sm-12">
                    <input type="hidden" id="targetId" name="target" value="${(target.id)!}">
                    <input type="text" id="targetName" name="targetName" value="${(target.name)!}" class="form-control"  readonly>
                    <a id="selectTree"  href="javascript:;">
                        <span class="add-on"><i class="icon-chevron-down"></i></span>
                    </a>
                </div>
            </div>
            <div class="form-group m-form__group row">
                <label class="col-form-label col-lg-3 col-sm-12"><@spring.message code="tree.move.to.target"/></label>
                <div class="col-lg-6 col-md-9 col-sm-12">
                    <button type="submit" class="btn btn-primary" id="moveAsPrev">
                    <@spring.message code="tree.btn.move.forwards"/>
                        <i class="la la-arrow-left"></i>
                    </button>
                    <button type="submit" class="btn btn-primary" id="moveAsNext">
                    <@spring.message code="tree.btn.move.backwards"/>
                        <i class="la la-arrow-right"></i>
                    </button>
                    <button type="submit" class="btn btn-primary" id="moveAsInner">
                    <@spring.message code="tree.btn.move.to.child"/>
                        <i class="la la-arrow-down"></i>
                    </button>
                    <a class="btn btn-default" href="<@BackURL/>">
                        <i class="la la-undo"></i>
                    <@spring.message code="button.back"/>
                    </a>
                </div>
            </div>
        </div>
    </form>
    <!--end::Form-->
</div>
<page-plugin-style>
<#include "/common/plugins/jquery.ztree.style.ftl" />
</page-plugin-style>
<page-plugin-script>
<#include "/common/plugins/jquery.ztree.script.ftl" />
</page-plugin-script>
<page-style>
</page-style>
<page-script>
	<script>
		jQuery(document).ready(function() {
			$.m.zTree.initSelectTree({
		        zNodes : null,
		        urlPrefix : "${ctx}/${baseUrl!}",
		        excludeId: "${source.id}",
		        async : true,
		        select : {
		            btn : $("#selectTree,#targetName"),
		            id : "targetId",
		            name : "targetName"
		        },
		        autocomplete : {
		            enable : true
		        }
		    });

		    $.m.zTree.initMoveBtn();
		});
	</script>
</page-script>